package com.hermit.alaskagulfcustom.feign;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author hermit
 * @data 2021/6/11
 * @description 降级处理结果
 */
@Component
@Slf4j
public class FeignServiceFallBack implements FallbackFactory<CustomFeign> {

    @Override
    public CustomFeign create(Throwable throwable) {
        return new CustomFeign() {
            @Override
            public String index() {
                return "生产者【provider】的服务被停用了，十分抱歉";
            }

            @Override
            public String testOpenFeign() {
                return "测试失败";
            }
        };
    }
}
